package com.bytech.article.biz.service.article;

import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bytech.common.biz.entity.article.Article;
import com.bytech.common.biz.entity.article.ArticleDto;
import com.bytech.common.biz.entity.article.ArticleQuery;
import com.bytech.common.biz.entity.base.BaseResult;
import com.bytech.common.biz.entity.timeline.TimeLineItem;
import com.bytech.common.biz.entity.timeline.TimeLineYear;

/**
 * @Author Zhao
 * @Create 2021-07-26
 */
public interface ArticleService extends IService<Article> {

    int getArticleCount();

    void deleteById(String id);

    /**
     * 文章点赞
     *
     * @return 点赞数变动值 1/-1
     */
    BaseResult<Integer> toggleThumb(String articleId, String userId);

    BaseResult<Article> saveArticle(ArticleDto articleDto);

    Page<ArticleDto> pageArticleByQuery(ArticleQuery<Article> articleQuery);

    ArticleDto getArticleDtoByIdAndViewer(String articleId, String viewer);

    void populateTags(List<ArticleDto> articleDtoList);

    /**
     * 根据年月分组构造时间线对象
     */
    List<TimeLineYear> buildTimeLine();
}
